<template>
  <div class="want-to-be-detail-container">
    <div class="want-to-be-detail-box">
      <div class="title">{{details.scenarioName}}</div>
      <div class="content">{{ details.scenarioDesc }}</div>
      <div class="more">
        <div class="text">相关附件</div>
        <div class="list" v-if="fileList && fileList.length">
          <div class="list-item" v-for="item in fileList" :key="item.id">
            <!-- :href="item.filePath ? item.filePath.replace('/file/maneuver-scenario/','maneuver-scenario-files/') : ''" -->
            <el-link
              type="primary"
              @click="handleDownload(item)"
            >
              {{ item.fileName }}
              <i class="el-icon-download"></i>
            </el-link>
          </div>
        </div>
      <el-empty v-else description="暂无附件" :image-size="100"></el-empty>
      </div>
    </div>
  </div>
</template>

<script>
import { downLoadFile } from '@/utils'
export default {
  props: ["detail"],
  computed: {
    details() {
      return this.detail || {};
    },
    fileList() {
      if (this.details) {
        if (this.details.scenarioType == 0) {
          return [
            ...(this.details.imgFiles || []),
            ...(this.details.scenarioFiles || []),
            ...(this.details.videoFiles || []),
          ]
        }
        return this.detail.scenarioFiles || [];
      } else {
        return []
      }
    },
  },
  data() {
    return {};
  },
  methods: {
    handleDownload(item) {
      downLoadFile(item)
    }
  }
};
</script>

<style lang="less">
.want-to-be-detail-container {
  padding: 47px 0;
  height: 100%;
  .want-to-be-detail-box {
    height: 100%;
    overflow: hidden;
    width: 68.8%;
    margin: 0 auto;
  display: flex;
  flex-direction: column;
  }
  .title {
    text-align: center;
    width: 100%;
    font-size: 18px;
    font-weight: bold;
    color: #383838;
    line-height: 48px;
  }
  .content {
    font-size: 14px;
    font-weight: 400;
    color: #333333;
    line-height: 24px;
    margin-bottom: 26px;
    height: 200px;
    overflow: auto;
  }
  .more {
    overflow: hidden;
    flex-grow: 1;
    .list {
      height: 100%;
      width: 100%;
      overflow: auto;
    }
    .text {
      font-size: 14px;
      font-weight: 400;
      color: #333333;
      line-height: 24px;
      padding-bottom: 14px;
      border-bottom: 1px solid #e6e8f0;
    }
    .list-item {
      margin-top: 22px;
      font-size: 14px;
      font-weight: 400;
      color: #666666;
      line-height: 24px;
      display: flex;
      align-items: center;
    }
  }
  .download-btn {
    width: 100px;
    height: 34px;
    background: #ffffff;
    border: 1px solid #00a56d;
    border-radius: 16px;
    text-align: center;
    line-height: 32px;
    margin: 0 auto;
    margin-top: 44px;
    cursor: pointer;
    color: #0fa284;
  }
}
</style>
